<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1,
            maximum-scale=1">
    <link rel="stylesheet" href="__STATIC__/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/css/public.css" media="all">
</head>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">

            <fieldset class="table-search-fieldset">
                <legend>搜索信息</legend>
                <div style="margin: 10px 10px 10px 10px">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">

                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <select name="modules" lay-verify="required" lay-search="" id="modules">
                                        <option value="">选择搜索的类型</option>
                                        <option value="job_number">工号</option>
                                        <option value="name">姓名</option>
                                        <option value="job_type">岗位类型</option>
                                        <option value="job_level">岗位等级</option>
                                        <option value="job_change_time">岗位等级变动时间</option>
                                        <option value="salary_level">薪级</option>
                                        <option value="salary_change_time">薪级变动时间</option>
                                        <option value="job_type_on_campus">校内岗位类型</option>
                                        <option value="job_level_on_campus">校内岗位等级</option>
                                        <option value="job_level_on_campus_time">校内岗位等级变动时间</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input type="text" name="value" id="value" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button type="submit" class="layui-btn layui-btn-primary" lay-submit
                                    lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                            </div>

                        </div>
                    </form>
                </div>
            </fieldset>

            <script type="text/html" id="toolbarDemo"></script>
            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

            <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
            
        </script>
        </div>
    </div>
    <script src="__STATIC__/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'table'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table;

            table.render({
                elem: '#currentTableId',
                url: "{:url('index/FileSalary/getfilesalary')}",
                toolbar: '#toolbarDemo',
                defaultToolbar: ['filter', 'exports', 'print', {
                    title: '提示',
                    layEvent: 'LAYTABLE_TIPS',
                    icon: 'layui-icon-tips'
                }],
                cols: [[
                    { type: "checkbox", width: 50 },
                    { field: 'user_id', width: 100, title: '用户ID', sort: true },
                    { field: 'job_number', width: 200, title: '工号', sort: true },
                    { field: 'name', width: 100, title: '姓名' },
                    { field: 'job_type', width: 200, title: '岗位类型' },
                    {
                        field: '', width: 200, title: '岗位等级', templet: function (d) {
                            return job_level(d.job_level);
                        }
                    },
                    { field: 'job_change_time', width: 200, title: '岗位等级变动时间' },
                    { field: 'salary_level', width: 200, title: '薪级' },
                    { field: 'salary_change_time', width: 200, title: '薪级变动时间' },
                    { field: 'job_type_on_campus', width: 200, title: '校内岗位类型' },
                    {
                        field: '', width: 200, title: '校内岗位等级', templet: function (d) {
                            return job_level(d.job_level_on_campus);
                        }
                    },
                    { field: 'job_level_on_campus_time', width: 200, title: '校内岗位等级变动时间', },
                    { title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center" }
                ]],
                limits: [10, 15, 20, 25, 50, 100],
                limit: 15,
                page: true,
                skin: 'line'
            });

            // 监听搜索操作
            form.on('submit(data-search-btn)', function (data) {
                //执行搜索重载
                table.reload('currentTableId', {
                    page: {
                        curr: 1
                    }
                    , where: {
                        value: $('#value').val(),
                        modules: $('#modules').val()
                    }
                }, 'data');

                return false;


            });

            /**
             * toolbar监听事件
             */


            //监听表格复选框选择
            table.on('checkbox(currentTableFilter)', function (obj) {
                console.log(obj)
            });

            table.on('tool(currentTableFilter)', function (obj) {
                var data = obj.data;
                if (obj.event === 'edit') {
                    var index = layer.open({
                        title: '编辑窗口',
                        type: 2,
                        shade: 0.2,
                        maxmin: true,
                        shadeClose: true,
                        area: ['100%', '100%'],
                        content: "{:url('index/FileSalary/edit')}?id=" + data.user_id,
                    });
                    $(window).on("resize", function () {
                        layer.full(index);
                    });
                    return false;
                } else if (obj.event === 'delete') {
                    layer.confirm('真的删除行么', function (index) {
                        obj.del();
                        layer.close(index);
                    });
                }
            });

        });
    </script>
    <script>
        function job_level(d) {
            if (d == 1) {
                return '<span>管理岗一级</span>';
            } else if (d == 2) {
                return '<span>管理岗二级</span>';
            } else if (d == 3) {
                return '<span>管理岗三级</span>';
            } else if (d == 4) {
                return '<span>管理岗四级</span>';
            } else if (d == 5) {
                return '<span>管理岗五级</span>';
            } else if (d == 6) {
                return '<span>管理岗六级</span>';
            } else if (d == 7) {
                return '<span>管理岗七级</span>';
            } else if (d == 8) {
                return '<span>管理岗八级</span>';
            } else if (d == 9) {
                return '<span>管理岗九级</span>';
            } else if (d == 10) {
                return '<span>管理岗十级</span>';
            } else if (d == 11) {
                return '<span>管理岗见习期</span>';
            } else if (d == 12) {
                return '<span>专业技术岗一级</span>';
            } else if (d == 13) {
                return '<span>专业技术岗二级</span>';
            } else if (d == 14) {
                return '<span>专业技术岗三级</span>';
            } else if (d == 15) {
                return '<span>专业技术岗四级</span>';
            } else if (d == 16) {
                return '<span>专业技术岗五级</span>';
            } else if (d == 17) {
                return '<span>专业技术岗六级</span>';
            } else if (d == 18) {
                return '<span>专业技术岗七级</span>';
            } else if (d == 19) {
                return '<span>专业技术岗八级</span>';
            } else if (d == 20) {
                return '<span>专业技术岗九级</span>';
            } else if (d == 21) {
                return '<span>专业技术岗十级</span>';
            } else if (d == 22) {
                return '<span>专业技术岗十一级</span>';
            } else if (d == 23) {
                return '<span>专业技术岗十二级</span>';
            } else if (d == 24) {
                return '<span>专业技术岗十三级</span>';
            } else if (d == 25) {
                return '<span>专业技术岗级见习期</span>';
            } else if (d == 26) {
                return '<span>专业技术岗</span>';
            } else if (d == 27) {
                return '<span>技工四级</span>';
            } else if (d == 28) {
                return '<span>技工五级</span>';
            } else if (d == 29) {
                return '<span>普通工</span>';
            } else if (d == 30) {
                return '<span>博士初期</span>';
            } else if (d == 31) {
                return '<span>硕士初期</span>';
            } else if (d == 32) {
                return '<span>本科初期</span>';
            }
        }
        function job_type_on_campus(d) {
            if (d == 1) {
                return '<span>管理岗</span>';
            } else if (d == 2) {
                return '<span>专业技术岗</span>';
            } else if (d == 3) {
                return '<span>工勤岗</span>';
            }
        }
    </script>
</body>

</html>